import 'package:flutter/material.dart';
import 'package:flutter_get_x/page/entrance/logic.dart';
import 'package:flutter_get_x/page/entrance/state.dart';
import 'package:flutter_get_x/resource_config.dart';
import 'package:get/get.dart';
import 'colors.dart' as Colors;

class EntrancePage extends StatelessWidget {
  final EntranceLogic logic = Get.put(EntranceLogic());
  final EntranceState state = Get.find<EntranceLogic>().state;

  @override
  Widget build(BuildContext context) {

    return Scaffold(
      body: Center(
        child: Stack(
          children: [
            Image.asset(
              ResourceConfig.IMG_LAUNCHER,
              fit: BoxFit.fill,
              width: double.infinity,
              height: double.infinity,
            ),
            Positioned(
              child: SizedBox(
                child: Stack(
                  alignment: Alignment.center,
                  children: [
                    Obx(()=> CircularProgressIndicator(
                      value: state.countDown.value,
                      backgroundColor: Color(Colors.WHITE),
                      valueColor:
                      new AlwaysStoppedAnimation<Color>(Color(Colors.APP)),
                    ),),
                    InkWell(child: Text("跳过", style: TextStyle(color: Color(Colors.WHITE), fontSize: 12),), onTap: logic.jump2NextPage ,),
                  ],
                ),
                height: 50,
                width: 50,
              ),
              right: 25,
              top: 25,
            ),
          ],
        ),
      ),
    );
  }
}
